/*
 * @(#)InstantMessage.java 0.0.1-SNAPSHOT
 *
 * Copyright Group B
 */

package grupb.upf.ms;

import java.util.List;
import org.jivesoftware.smack.packet.Message;

/**
 * <p>This interface allows us to exchange information with Google Talk: login,
 * logout, send and receive Searches, send and receive Search Results, and
 * send and receive UserContent messages.</p>
 *
 * <p>It has contains the listeners of the dif ferent kind of messages.
 * It is important to say that this listeners aren't definetively and maybe
 * they will be in separately classes. Furthermore, here we simulate
 * the search into the database but it isn't implemented yet.</p>
 *
 * @version    0.0.1-SNAPSHOT
 * @author     Group B
 */

public interface InstantMessage {
    /**
     * This method allows us to connect and identif icate to GoogleTalk.
     * @param aLogin is the userName of the Google Account (account@gmail.com)
     * @param aPassword is the password of the Google Account
     * @param resource is the resource, usually "Home"
     * @return boolean (true if it has logged and false if not)
     */
    boolean login(String aLogin, String aPassword, String resource);
    /**
     * This method allows us to logout from GoogleTalk.
     */
    void logout();
    /**
     * Method to send a message.
     * @param msg the message to be sent.
     */
    void sendMessage(Message msg);
    /**
     * This method allows us to send a SearchProfile.
     * @param searchProfile the object SearchProfile which we are looking for
     */
    void sendSearchProfile(SearchProfile searchProfile);
    /**
     * This method allows us to send a SearchProfile to a concrete user.
     * @param searchProfile the object SearchProfile which we are looking for
     * @param to the destinator of our request
     */
    void sendSearchProfile(SearchProfile searchProfile, String to);
    /**
     * This method is in charge to answer the searchProfile messages received.
     * @param search the search to send
     * @param to the user who has to receive the message
     */
    void sendSearchResult(SearchResult search, String to);
    /**
     * This method allows us to send UserContent message.
     * @param uc the userContent to request
     * @param to the destinator of our request
     */
    void sendUserContent(UserContent uc, String to);
    /**
     * This method allows us to send instant messages.
     * @param message the message to send
     * @param to the destinator of our message
     */
    void sendInstantMessage(String message, String to);
    /**
     * This method allows us to send a message to all the connected friends.
     * @param message the message to send
     */
    void sendChatMessage(String message);
    /**
     * This function return the list of connected users.
     * @return the list of connected users
     */
    List getConnectedUsers();

    /**
     * Method to add a user to the list of connected users.
     * @param user the user to add
     */
    void addConnectedUser(String user);

    /**
     * Method to remove a user from the list of connected users.
     * @param user the user to remove
     */
    void setDisconnectedUser(String user);
}
